import HttpService from '../../app/services/httpService.js';

class ScoreService extends HttpService {
    constructor($http, $q){
        super($http, $q)

        this.URL = this.baseUrl();

        this.OBJ = {
        	ScorePublishUrl: this.URL + '/score/publish?race_id=',
            RawdataCreateUrl: this.URL + '/rawdata/add?race_id=',
            RawdataClearUrl: this.URL + '/rawdata/del?race_id=',
            RawdataStatusUrl: this.URL + '/rawdata/status?race_id=',
            RealtimeListUrl: this.URL + '/realtime/lists?race_id=',
            RealtimeRunnerUrl: this.URL + '/realtime/runner?course_id=',
            RealtimeTeamUrl: this.URL + '/realtime/team?course_id=',
            RealtimeTeamDetailUrl: this.URL + '/realtime/teamdetail?course_id=',
            RealtimeTeamRecalcUrl: this.URL + '/realtime/recalc?race_id=',
            RealtimeupdateScoreUrl: this.URL + '/realtime/update?score_id=',
            RealtimeScoreCalcUrl: this.URL + '/score/calc?race_id=',
            RealtimeScorePublishUrl: this.URL + '/score/publish?race_id=',
            RealtimeCircleDistUrl: this.URL + '/realtime/teamlist?race_id=',
            ScoreClearUrl: this.URL + '/score/clear?race_id=',
        }

    }

    /* 发布成绩 */
    getScorePublish(headers, search) {
        return this.getRequest(this.OBJ.ScorePublishUrl, headers, search);
    }

    /* 新增数据 */
    postRawdataCreate(params, headers, search) {
        return this.postRequest(this.OBJ.RawdataCreateUrl, params, headers, search);
    }

    /* 清空原始数据 */
    postRawdataClear(params, headers, search) {
        return this.postRequest(this.OBJ.RawdataClearUrl, params, headers, search);
    }

    /* 设置无效 */
    postRawdataStatus(params, headers, search) {
        return this.postRequest(this.OBJ.RawdataStatusUrl, params, headers, search);
    }
    
    /* 实时成绩 */
    getRealtimeList(headers, search) {
        return this.getRequest(this.OBJ.RealtimeListUrl, headers, search);
    }

    /* 个人成绩 */
    getRealtimeRunner(headers, search) {
        return this.getRequest(this.OBJ.RealtimeRunnerUrl, headers, search);
    }

    /* 团队成绩 */
    getRealtimeTeam(headers, search) {
        return this.getRequest(this.OBJ.RealtimeTeamUrl, headers, search);
    }

    /* 团队成绩详情 */
    getRealtimeTeamDetail(headers, search) {
        return this.getRequest(this.OBJ.RealtimeTeamDetailUrl, headers, search);
    }

    /* 重新计算成绩 */
    getRealtimeTeamRecalc(headers, search) {
        return this.getRequest(this.OBJ.RealtimeTeamRecalcUrl, headers, search);
    }

    /* 选手置无效 */
    getRealtimeupdateScore(headers, search) {
        return this.getRequest(this.OBJ.RealtimeupdateScoreUrl, headers, search);
    }

    /* 重新计算成绩（new） */
    getRealtimeScorecalc(headers, search) {
        return this.getRequest(this.OBJ.RealtimeScoreCalcUrl, headers, search);
    }

    /* 发布成绩（new） */
    getRealtimeScorePublish(headers, search) {
        return this.getRequest(this.OBJ.RealtimeScorePublishUrl, headers, search);
    }

    /* 团队绕圈定距realtime获取 */
    getRealtimeCircleDistData(headers, search) {
        return this.getRequest(this.OBJ.RealtimeCircleDistUrl, headers, search);
    }

    /* 清空选手成绩 */
    postScoreClear(headers, search) {
        return this.postRequest(this.OBJ.ScoreClearUrl, {}, headers, search);
    }
}

export default ScoreService;